//
//  MyLoginViewController.m
//  DeliciousFood1
//
//  Created by brother on 15/10/21.
//  Copyright © 2015年 com.hxm. All rights reserved.
//

#import "MyLoginViewController.h"
#import "LoginAndRegister.h"
#import "RegisterViewController.h"
#import "LoginViewController.h"

@interface MyLoginViewController ()

@property (nonatomic,strong) LoginAndRegister *lar;

@end



@implementation MyLoginViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self.tabBar removeFromSuperview];
    
    self.lar = [LoginAndRegister loginAndRegisterWithFrame:CGRectMake(0, 60, [[UIScreen mainScreen] bounds].size.width,50)];
    [self.view addSubview:self.lar];
    
    LoginViewController *login = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    [self addChildViewController:login];
  
    RegisterViewController *registers = [[RegisterViewController alloc] initWithNibName:@"RegisterViewController" bundle:nil];
    [self addChildViewController:registers];
    
    [self.lar.login addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.lar.login.tag = 1001;
    [self.lar.myRegister addTarget:self action:@selector(clickTab:) forControlEvents:UIControlEventTouchUpInside];
    self.lar.myRegister.tag = 1002;
}

- (void)clickTab:(UIButton *)sender {
    if (sender.tag == 1001) {
        [self setSelectedIndex:0];
    }else {
        [self setSelectedIndex:1];
    }
}
- (IBAction)back:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
